package Day08方法;

//定义方法 模拟取款机

import java.util.Scanner;

public class KuoZhan {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("张研 您好!");

        int i = 6426435;
        double i1 = 5412181.00;
        int count = 0;
        for (; ; ) {
            System.out.println("请输入密码:");
            double mima = sc.nextDouble();
            if (mima == i) {
                System.out.println("输入取款金额:");
                double x = sc.nextDouble();

                double money = demo(x);//调用方法

                double i2 = i1 - money;
                System.out.println("取款:" + money + ",余额:" + i2);
                System.exit(0);
            } else {
                System.out.println("密码错误!请重新输入!");
                count++;
                if (count == 5){
                    System.out.println("密码错误,已锁定!");
                    System.exit(0);
                }
            }
        }
    }

    public static double demo(double money) {
        System.out.println("取款:" + money);
        return money;
    }
}
